perm filename ULOGR.MID[NET,MRC]2 blob
sn#351165 filedate 1978-04-21 generic text, type C, neo UTF8
COMMENT ā VALID 00004 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 TITLE ULOGR
C00005 00003 Initialization
C00008 00004 RFC server
C00011 ENDMK
Cā;
TITLE ULOGR
SUBTTL Definitions
; Mark Crispin, SU-AI, April 1978
; User mode ARPAnet connection logger
; AC definitions
A=1 ? B=2 ? X=10 ? P=17
; Assembly switches
PDLLEN==50 ; length of pushdown stack
; I/O device definitions
IOP==110 ? TV==404
; SAIL system bit definitions
INTIMS==000020,, ; RFC arrived
RFCS== 200000,, ; RFC sent
RFCR== 100000,, ; RFC received
CLSS== 040000,, ; CLS sent
CLSR== 020000,, ; CLS received
LGONCE==004000,, ; here already
REAPRV==040000,, ; read anywhere
WRTPRV==020000,, ; write anywhere
ACWPRV==000040,, ; patch core
LUPPRV==000001,, ; local user
PRIVS==REAPRV\WRTPRV\ACWPRV\LUPPRV ; privileges needed
; Data area
PDL: BLOCK PDLLEN ; pushdown stack
; SWAP UUO block
SWPBLK: 'DSK,, ; device name
SVRNAM: 'RFC,, ; program name
14 ; phantom job
0 ; normal core size and start address
'NETSYS ; file directory
RUNPPN: BLOCK 1 ; PPN to be run under
; Pointers into the monitor
FFLNK: BLOCK 1 ; first free link
LOGGER: BLOCK 1 ; job number of user mode logger
; Pointers to IMP tables are indexed up by 1, so RH is addr-1
LNKTAB: (X) ; host-link number
IMPDDB: (X) ; address of DDB
IMPLS: (X) ; local socket number
IMPFS: (X) ; foreign socket number
IMPSTB: (X) ; link status
SUBTTL Initialization
ULOGR: JFCL
RESET
MOVE P,[PDL(-PDLLEN)]
MOVSI (PRIVS)
SETPRV
TLC (PRIVS)
TLNN (PRIVS)
JRST ULOGR1 ; finally came to their senses
MOVSI 377777 ; damnit, get them privs!
SETPR2
JRST 4,.-1
HRRO 2,400271 ; JBTPRV (so privs go away if stopped)
MOVE 1,400226 ; JOB
ADD 2,400000(1)
EIOTM
CONO IOP,
DATAO IOP,2
CONO TV,3002
DATAO TV,[1,,40000]
MOVEI 1
CONSO IOP,10 ; wait for them to come on
JRST [SLEEP ? JRST .-1]
MOVE 400000(2) ; in case 167 is losing
TLC (PRIVS)
TLNN (PRIVS)
JRST 2,@[ULOGR1]
OUTSTR [ASCIZ/Put a -1 in your JB2PRV/]
EXIT
ULOGR1: IRPS SYM,,LOGGER FFLNK
MOVEI [.RSQZ 0,SYM ? 0]
.SYML
JRST 4,.-1
ADDI 400000
MOVEM SYM
TERMIN
IRPS SYM,,LNKTAB IMPDDB IMPLS IMPFS IMPSTB
MOVEI [.RSQZ 0,SYM ? 0]
.SYML
JRST 4,.-1
ADDI 377777
HRRM SYM
TERMIN
MOVSI 377776 ; map monitor in with write access
SETPR2
JRST 4,.-1
MOVE A,400226 ; JOB
MOVE A,400000(A)
MOVEM A,@LOGGER ; seize the logger resource
MOVE B,400211 ; PRJPRG
ADDI B,400000(A)
MOVE B,(B)
MOVEM B,RUNPPN ; set running PPN of servers
MOVEI [DISMIS] ; set up interrupt
MOVEM JOBAPR
MOVSI (INTIMS) ; magic logger interrupt
INTENB
OUTSTR [ASCIZ/User mode LOGGER started
/]
; (continued on next page)
SUBTTL RFC server
RFCSER: MOVE X,@FFLNK ; set up pointer to links
CHKLNK: SKIPE @IMPDDB ; ignore links with a DDB
JRST NXTLNK
MOVE @IMPSTB ; get status of this link
TLNE (RFCR) ; somebody listening?
TLNE (RFCS\CLSR\CLSS\LGONCE) ; link already been munged?
JRST NXTLNK
MOVSI (LGONCE)
IORM @IMPSTB ; flag we've looked at the link
MOVE @IMPLS ; get socket for this link
CAIGE 400 ; public socket?
TRNN 1 ; and heterosocketual?
JRST NXTLNK
PUSH P,@IMPFS ; save socket info on stack
PUSH P,@IMPLS
PUSH P,@LNKTAB
LSHC -6 ; separate 3 digits by three bits
LSH 3
LSHC 3
LSH 3
LSHC 3
ADDI '000 ; form sixbit socket number
HRRM SVRNAM
MOVEI SWPBLK
SWAP ; fire up the server
JUMPE [ OUTSTR [ASCIZ/Ign RFC/]
JRST CONMSG] ; couldn't fire up server!
OUTSTR [ASCIZ/RFC j=/] ; server job
PUSHJ P,DECOUT
CONMSG: OUTSTR [ASCIZ/, hst=/] ; host number
LDB [101017,,]
PUSHJ P,OCTOUT
OUTSTR [ASCIZ/, lnk=/] ; link number
POP P,
ANDI 377
PUSHJ P,DECOUT
OUTSTR [ASCIZ/, lsk=/] ; local socket number
POP P,
PUSHJ P,OCTOUT
OUTSTR [ASCIZ/, fsk=/] ; foreign socket number
POP P,
PUSHJ P,OCTOUT
OUTSTR [ASCIZ/.
/]
NXTLNK: SOJG X,CHKLNK ; try next link
IWAIT ; wait for next interrupt
JRST RFCSER
; Decimal/octal print routine
DECOUT: SKIPA B,[10.] ; decimal print
OCTOUT: MOVEI B,8. ; octal print
NUMOUT: IDIVI (B)
PUSH P,A
SKIPE
PUSHJ P,NUMOUT
POP P,
ADDI "0
OUTCHR
POPJ P,
END ULOGR